using System;
using System.Threading;

namespace ContinualFlame.Ajax
{
	public class Message
	{
		static long s_lastWatermark = 0;

		public Message()
		{
			Watermark = Interlocked.Increment(ref s_lastWatermark);
            Type = this.GetType().Name;
		}
		
		// object type (used to distinguish between event types)
        public string Type { get; set; }
		
		// named collection or stream that this object belongs to
		public string Source { get; set; }
		
		// key for items in a dictionary
		public string Name { get; set; }
		
		// change # to make resync'ing with a disconnected client simple
		// normally read-only, but we allow a setter for JSON deserialization
		public long Watermark { get; set; }
	}
}
